<?php
require "web.config.php";
 class homeController
 {
     //------------------------------前端
      //-----------------主页
     //首页
   function index($param){   
$home_layout = show("home_layout",1);  
$home_column = show("home_column",-1,"id","asc");
$home_link = show("home_link");
$home_music =show("home_music");

//var_dump($home_layout);die();
//访问量
sql("update dt set hits=hits+1");


//           var_dump(json_decode(cache_r("home_layout")['value'])); //  die();
     
        include view(__ROOT__,str_replace('Controller','',__CLASS__),__FUNCTION__,'homeShare');//加载视图   
}   
    
     static $db_tie='tie'; 
      function page($param){
     $output = show(sprintf('select m.*,u.Id uId,u.nickname,u.QQ_pic from %s m left join user u on m.userId=u.Id where m.Id=%s order by m.time desc',self::$db_tie,$param),'sql')[0];
//   var_dump($output);
  	  include view(__ROOT__,str_replace('Controller','',__CLASS__),__FUNCTION__,'homeShare');//加载视图
  }
  
  //获取登录用户信息
 function getLoginU(){
 	global $m;
 	$openid=getSession($m->data['qq']);
	$loginUser= show('user',$openid,'openid'); 
	setSession('loginId',$loginUser['Id']);
	$rt=array(
	"data"=>$loginUser,
	);
	show_json(empty($loginUser)?0:1,$rt);
 }
 
 

 //退出
          function logout($id){     
global $m;
//删除当前存储的openid，取消登陆状态
delSession($m->data["qq"]); 
//删除当前浏览器的qq登陆数据，下次登陆会重新获取
delSession('QC_userData','json');
}
 
//------------------------------------------------------留言


  
function Post_Msg(){
$dt = $_POST['data'];
//var_dump($dt);
$dt["time"]=date("Y-m-d H:i:s");
$id = 0; //add
//var_dump($id);die();

$myValue = JsonUpdate("message",$dt,$id);

show_json($myValue,($myValue>0?'提交成功':'提交失败'));

}


//删除
           function delPost_Msg($id){     

$myValue =del("message",$id,SplitUrl("homepage/column/message"));
}  
     


}
 
 
 
?>